<template>
  <div class="home-container">
    <div class="welcome-section">
      <img src="@/assets/logos/logo.png" alt="Electron Vue Logo" class="welcome-logo" />
      <h1 class="welcome-title">欢迎使用 Zephyr 框架</h1>
      <p class="welcome-subtitle">一个美观大气、高效易用的桌面应用开发框架</p>
      
      <div class="feature-cards">
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :md="8" v-for="(feature, index) in features" :key="index">
            <el-card class="feature-card" shadow="hover">
              <div class="feature-icon">
                <el-icon :size="40"><component :is="feature.icon" /></el-icon>
              </div>
              <h3 class="feature-title">{{ feature.title }}</h3>
              <p class="feature-desc">{{ feature.description }}</p>
            </el-card>
          </el-col>
        </el-row>
      </div>
      
      <div class="action-buttons">
        <el-button type="primary" size="large" @click="startDemo">
          <el-icon><VideoPlay /></el-icon>
          开始体验
        </el-button>
        <el-button size="large" @click="viewDocs">
          <el-icon><Document /></el-icon>
          查看文档
        </el-button>
      </div>
    </div>
    
    <el-divider>技术栈</el-divider>
    
    <div class="tech-stack">
      <div class="tech-item" v-for="(tech, index) in techStack" :key="index">
        <img :src="tech.logo" :alt="tech.name" class="tech-logo" />
        <span class="tech-name">{{ tech.name }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { 
  Cpu, 
  Monitor, 
  MagicStick,
  Promotion, 
  Connection, 
  TrendCharts,
  VideoPlay,
  Document
} from '@element-plus/icons-vue';

const router = useRouter();

const features = ref([
  {
    icon: 'Cpu',
    title: '高性能',
    description: '基于Electron和Vite构建，提供极速的开发体验和运行效率'
  },
  {
    icon: 'Monitor',
    title: '跨平台',
    description: '一次开发，支持Windows、macOS和Linux多平台部署'
  },
  {
    icon: 'MagicStick',
    title: '美观界面',
    description: '精心设计的UI组件和动画效果，提供出色的视觉体验'
  },
  {
    icon: 'Promotion',
    title: '易于扩展',
    description: '模块化设计，便于功能扩展和二次开发'
  },
  {
    icon: 'Connection',
    title: '强大生态',
    description: '集成Vue3生态系统，享受丰富的组件和插件支持'
  },
  {
    icon: 'TrendCharts',
    title: '开发效率',
    description: '热重载、ESM等现代化开发体验'
  }
]);

const techStack = ref([
  { name: 'Zephyr', logo: 'src/assets/logos/logo.png' },
  { name: 'Vue 3', logo: 'src/assets/logos/vue.svg' },
  { name: 'Vite', logo: 'src/assets/logos/vite.svg' },
  { name: 'JavaScript', logo: 'src/assets/logos/javascript.png' },
  { name: 'Element Plus', logo: 'src/assets/logos/element-plus.jpg' }
]);

const startDemo = () => {
  // 这里可以跳转到演示页面或启动演示功能
  router.push('/about');
};

const viewDocs = () => {
  // 这里可以打开文档页面
  router.push('/settings');
};
</script>

<style lang="scss" scoped>
.home-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-section {
  text-align: center;
  padding: 40px 0;
}

.welcome-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.welcome-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: 18px;
  color: var(--regular-text-color);
  margin-bottom: 40px;
}

.feature-cards {
  margin-bottom: 40px;
}

.feature-card {
  height: 100%;
  text-align: center;
  padding: 20px;
  transition: transform 0.3s;
  
  &:hover {
    transform: translateY(-5px);
  }
}

.feature-icon {
  margin-bottom: 15px;
  color: var(--primary-color);
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.feature-desc {
  color: var(--regular-text-color);
  line-height: 1.5;
}

.action-buttons {
  margin: 30px 0;
  
  .el-button {
    margin: 0 10px;
  }
}

.tech-stack {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
  margin: 30px 0;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
    transition: transform var(--transition-duration) var(--easing-function);
    
    &:hover {
      transform: scale(1.1);
    }

    .tech-logo {
      width: 48px;
      height: 48px;
      object-fit: contain;
      transition: filter var(--transition-duration) ease;
      filter: grayscale(100%) brightness(110%);
      transition: filter 0.3s var(--easing-smooth), transform 0.3s var(--easing-smooth);

      &:hover {
        filter: grayscale(0%) brightness(100%);
        transform: rotate(5deg) scale(1.1);
      }
    }
}

.tech-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
}

.tech-name {
  font-size: 14px;
  color: var(--regular-text-color);
}

@media (max-width: 768px) {
  .welcome-title {
    font-size: 24px;
  }
  
  .welcome-subtitle {
    font-size: 16px;
  }
  
  .feature-cards {
    margin-bottom: 20px;
  }
  
  .tech-logo {
    width: 40px;
    height: 40px;
  }
}
</style>
